﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using SnippetBox.Core.Common.Mvc.Validation;
using SnippetBox.Core.Data.Models;

namespace SnippetBox.Web.Models {
    public class EditProfileModel {
        public EditProfileModel() {}

        public EditProfileModel(User user) {
            Email = user.Email;
            TwitterUsername = user.TwitterUsername;
            Website = user.Website;
        }

        [DataType(DataType.Password), MaxLength(100)]
        public string Password { get; set; }

        [DataType(DataType.Password), MaxLength(100), Compare("Password", ErrorMessage = "Passwords do not match")]
        public string ConfirmPassword { get; set; }

        [RegularExpressionAttribute(Regexps.EMAIL, ErrorMessage = "Please enter a valid email address")]
        public string Email { get; set; }
        [MaxLength(15)]
        public string TwitterUsername { get; set; }
        [MaxLength(100)]
        public string Website { get; set; }
    }
}